<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
	<title>商品查看</title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
 	
   
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>导入商品查看</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">采购目录管理</a></li>
            <li class="active"><a href="#">商品目录管理</a></li>
            <li class="active"><a href="#">商品导入查看</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
        <div class="box-body">
                <div class="form-inline">
                     <div class="form-group form-group-xs">
                        <label for="txtDrugComp">导入状态：</label>
                        <select class="form-control" id="status" name="status" style="width: 140px;">
                        	<option value="">请选择</option>
                        	<option value="可导">可导</option>
                        	<option value="不可导">不可导</option>
                        </select>
                    </div>
                    <button type="button"  onclick="dataSearch()"  class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>
         
        <table class="jqgrid" id="list4"></table>
        <div id="prowed2"></div>
		<div class=" box box-warning bottongroup" id="bottongroup">
		
			<label onclick="importdata();" class="btn btn-default btn-sm">确认导入</label>
			<label  onclick="batchSwitchStatus('1');"   class="btn btn-default btn-sm" >放弃</label>
		</div>
            
            <input type="hidden" name="data" id="data" value='${allList }'/>
</section>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript" src="${ctx }/js/batchImportView.js"></script>
<script type="text/javascript">
function importdata(){
	$.post("${pageContext.request.contextPath}/baseGoods/bathImport.html", {
		validList : '${validList}'
	}, function(result) {
		if (result.success) {
			$.HN.message.alert("导入成功！", "消息", "success");
			window.location.href='${pageContext.request.contextPath}/baseGoods/toList.html';
		} else {
			$.HN.message.alert("操作失败！", "消息", "error");
		}
	}, "json")
}
odata= eval('(${allList })');
$(function () {
	
jQuery("#list4").jqGrid({
	//url: "${ctx}/baseGoods/getDataList.html",
	data:odata,
	datatype: "local",
	autowidth: true,
	shrinkToFit: false,
	height: 250,
   	colNames:['商品编码','所属项目编码','所属项目名称','药品编码','通用名','剂型','规格','转换系数','单位','药品分类','采购限价','最高零售价','导入状态','备注'],
   	colModel:[
		{name:'goodsCode',index:'goodsCode',key:true, width:80, sorttype:false},
   		{name:'projCode',index:'projCode', width:80, sorttype:false},
   		{name:'projectName',index:'projCode', width:80, sorttype:false},
   		{name:'drugCode',index:'drugCode', width:80, align:"center"},
   		
   		
   		{name:'drugName',index:'drugName', width:80, align:"center"},
   		{name:'formName',index:'formName', width:80, align:"center"},
   		{name:'specName',index:'specName', width:80, align:"center"},
   		{name:'factor',index:'factor', width:80, align:"center"},
   		{name:'unit',index:'unit', width:80, align:"center"},
   		
   		{name:'drugCatText',index:'drugCatText', width:80, align:"left",sorttype:false},
   		{name:'proPriceLimitText',index:'proPriceLimit', width:60, align:"right",sorttype:false},
   		{name:'retailPriceLimitText',index:'retailPriceLimit', width:60, align:"right",sorttype:false},
   		{name:'statusText',index:'statusText', width:60, align:"right",sorttype:false},
   		{name:'remark',index:'remark', width:100, align:"center",sorttype:false}
   	],
	 //rowNum: 20,
     //rowList: [10, 20, 30],
     rownumbers: true,
     //multiselect: true,
     //pager: "#prowed2",
     viewrecords: true,
     caption: "商品列表",
     editurl:"proPlanItemListHis.jsp",
     jsonReader: {
         repeatitems: false,
         id: "ids"
     }
   	
});
	 
	jQuery("#list4").jqGrid('navGrid',"prowed2",{edit:false,add:false,del:false});
	
});

function dataSearch(){
        var status = $.trim($("#status").val());
        if (status != ""){
        	$("#list4").jqGrid('clearGridData');
            for (var i = 0; i < odata.length; i++) {
                if (status == odata[i].statusText) {
                    jQuery("#list4").jqGrid('addRowData', i + 1, odata[i]);
                }
            }
        } else {
        	$("#list4").jqGrid('clearGridData');
            for (var i = 0; i < odata.length; i++) {
                    jQuery("#list4").jqGrid('addRowData', i + 1, odata[i]);
            }
        }
        
}

</script>
</body>
</html>